home *** CD-ROM | disk | FTP | other *** search
- unit ntc_client_sun;
- {
- Copyright (C) 2004 - 2006 Andrew Sprott
-
- http://astronomy.crysania.co.uk
- astro@trefach.co.uk
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- }
-
- interface
-
- uses
- Windows,
- Messages,
- SysUtils,
- Variants,
- Classes,
- Graphics,
- Controls,
- Forms,
- Dialogs,
- ExtCtrls,
- StdCtrls,
- inifiles,
-
- ntc_client_form;
-
- type
- Tscope_sun = class(TForm)
- sun_panel: TPanel;
- sun_group: TGroupBox;
- sun_shape: TShape;
- { form functions }
- procedure formcreate(
- Sender:TObject);
-
- procedure form_close_query(
- Sender: TObject;
- var CanClose: Boolean);
-
- { configuration }
- procedure load_settings;
-
- procedure save_settings;
-
- { events }
- procedure FormShow(
- Sender:TObject);
-
- procedure adjust;
-
- procedure check_activate(
- Sender: TObject);
-
- private
- { Private declarations }
- public
- { Public declarations }
- { configuration }
- dimensions:dimensions_record;
-
- { events }
- procedure check_visible_and_show_hide(
- sender:tobject);
-
- procedure hide_form;
- procedure show_form;
- end;
-
- var
- scope_sun: Tscope_sun;
-
- implementation
-
- {$R *.dfm}
-
- { -------------
- form controls
- ------------- }
-
- procedure tscope_sun.formcreate(
- Sender:TObject);
- begin
- load_settings;
- end;
-
- procedure tscope_sun.form_close_query(
- Sender: TObject;
- var CanClose: Boolean);
- begin
- canclose:=false;
- visible:=false;
- with dimensions do
- begin
- form_top:=top;
- form_left:=left;
- end;
- end;
-
- { -------------
- configuration
- ------------- }
-
- procedure tscope_sun.load_settings;
- begin
- ini_file:=tinifile.create(application_path+'client.ini');
- with ini_file do
- begin
- { form }
- scope.get_dimensions(scope_sun,@dimensions,'sun',ini_file);
- left:=dimensions.form_left;
- top:=dimensions.form_top;
- visible:=readbool('sun','visible',false);
- end;
- ini_file.free;
- end;
-
- procedure tscope_sun.save_settings;
- begin
- with ini_file do
- begin
- { form }
- scope.find_vdu(scope_sun,@dimensions);
- scope.write_dimensions(@dimensions,left,top,'sun',ini_file);
- writebool('sun','visible',visible);
- end;
- end;
-
- { ------
- events
- ------ }
-
- procedure tscope_sun.FormShow(
- Sender:TObject);
- begin
- with dimensions do
- begin
- top:=form_top;
- left:=form_left;
- end;
- end;
-
- procedure tscope_sun.adjust;
- begin
- with dimensions do
- begin
- form_top:=trunc(form_top/last_screen_height*current_height);
- form_left:=trunc(form_left/last_screen_width*current_width);
- end;
- if visible then
- show;
- end;
-
- procedure tscope_sun.check_visible_and_show_hide(
- sender:tobject);
- begin
- if visible then
- hide_form
- else
- show_form;
- scope.show_hide(sender,visible);
- end;
-
- procedure tscope_sun.hide_form;
- begin
- with dimensions do
- begin
- form_top:=top;
- form_left:=left;
- end;
- Visible:=false;
- end;
-
- procedure tscope_sun.show_form;
- begin
- Visible:=true;
- end;
-
- procedure tscope_sun.check_activate(
- Sender: TObject);
- begin
- scope.form_activate(scope_sun,@dimensions);
- end;
-
- end.
-